const { reject } = require("bluebird");

function main1() {
  console.log(1);
}

function main2() {
  console.log(2);
}

function main3() {
  console.log(3);
}

function foo(number) {
  return new Promise((resolve, reject) => {
    if (number < 10) {
      resolve(1);
    } else {
      reject(new Error);
    }
  })
}
foo(2)
  .then((data) => {
    console.log('data:' + data);
  })
  .then(main2)
  .then(main3);